<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="../../../attr.jsp" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>touchTouchNew</title>
<script src="${ctx }/js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="${ctx}/js/jquery.js"></script>
<script src="${ctx }/js/touchTouchNew.jquery.js"></script>
<link href="${ctx }/css/style.css" rel="stylesheet">
<link href="${ctx }/css/font-awesome.min.css" rel="stylesheet">
<link href="${ctx }/css/touchTouchNew.css" rel="stylesheet">
<style type="text/css">
    #fileMC{margin-left: 300px;}
    #fanhui:hover{color:white;}
    #shanchu:hover{color:white;}
    #shangchuan:hover{color:white;}
    .sp{padding-left: 30px;padding-top:5px;background-color: #4296dc;height:35px;}
    .sp>span{text-align: center;line-heig ht: 5px;padding-left: 30px; }
    #first{display:flex;flex-wrap:wrap;overflow-y:auto;}
    #first>div{display:flex;flex-direction:column;width:16%;height:200px;overflow-x:auto;margin-top:5px;}
    #first>div img{display:block;left:0;right:0;margin:auto}
    #first>div>span:nth-of-type(1):{display:flex;}
    .text-c{display:block;text-align:center;font-size:12px;}
</style>
</head>
<body>

<div class="sp">
<span id="fanhui"><img alt="" src="../imgs/fanhui.png" width="25px;" height="25px; " style="vertical-align: middle;">返回</span>&nbsp;&nbsp;
<span id="shanchu"><img alt="" src="../imgs/shanchu.png" width="20px;" height="20px;" style="vertical-align: middle;">删除</span>&nbsp;&nbsp;
<span id="shangchuan"><img alt="" src="../imgs/shangchuan.png" width="20px;" height="20px;" style="vertical-align: middle;">上传</span>
<span id="fileMC">${file.fileName }</span>
</div>
<!-- check images href -->
<div id="aaa" class="bbb"> 
	<div id="first" class="overfirst">
	    <c:if test="${shift != null }">
	        <c:forEach items="${shift }" var="tp">
                <div class="tupian">
                    <a href="${ctx }${tp.shiftImg }">
                       <img src="${ctx }${tp.shiftImg }" width="145px;" height="145px;">
                    </a>
                    <span class="text-c"><input type="checkbox" value="${tp.shiftId }" name="key" >${tp.shiftTitle }</span>
                </div> 
			</c:forEach>
	    </c:if>
	    <c:if test="${empty shift }">
            <div>
            <span style="color: red;">该文件夹是空的</span>
            </div> 
	    </c:if>
    </div>
</div>
</body>
<script>
    var wj = <%= request.getAttribute("wj") %>;
	$(document).ready(function(e) {
        $('#first a').touchTouchNew();
        $("#fanhui").click(function(){
        	window.location.href="${ctx}/shift/wenkuList.do";
        });
        $("#shanchu").click(function(){
        	var btn = true;
        	var chks = getSelRecord();
        	if(chks.length==0){
            	alert("请选择要刪除的文件");
            	btn=false;
            }
        	if(btn){
            	$.ajax({
        			type:"post",
        			url:"${ctx}/shift/deletebatch.do?chk3="+chks.join(),
        			error:function(){
        				layer.alert("网络故障，稍后再试");
        			},
        			success:function(data){
        				if(data.status=="true"){
        	 	           	layer.alert(data.msg,function(){
        	 	           		window.location.reload();
        	 	           		$("input[type='checkbox']").each(function(){
        	 	           			$(this).prop('checked',false);
        	 	           		});
        	 	           	});
        	           	}
        			}
        		});
            }
        });
        
        $("#shangchuan").click(function(){
        	var leixing = 1;
        	window.location.href="${ctx}/shift/shiftEdit.do?lx="+leixing+"&wj="+wj;
        });
    });
	
	function getSelRecord(){
		var chk_value =[];
	    $('input[name="key"]:checked').each(function(){
			chk_value.push($(this).val()); 
		});
		return chk_value;
	}
</script>
</html>
